package com.dingding.study.service.事件发布机制;

import com.google.common.eventbus.EventBus;

/**
 * @program: spring-learning
 * @description:
 * @author: liugongding
 * @create: 2021-09-10 15:56
 **/
public class MyEventBus {

    /** 事件任务总线 */
    private final static EventBus tiemEventBus = new EventBus();
    /**
     * 触发同步事件
     *
     * @param event
     */
    public static void post(Object event) {
        tiemEventBus.post(event);
    }
    /**
     * 注册事件处理器
     *
     * @param handler
     */
    public static void register(Object handler) {
        tiemEventBus.register(handler);
    }
    /**
     * 注销事件处理器
     *
     * @param handler
     */
    public static void unregister(Object handler) {
        tiemEventBus.unregister(handler);
    }
}
